package httprouter

import (
	"github.com/gin-gonic/gin"
	"nood/app/controller/http/example"
	"nood/app/controller/http/user"
)

func Init(service *gin.Engine) {
	RegisterRouter(service)
	RegisterGameRouter(service)
	RegisterStaticRouter(service)
}

// 注册用户相关路由
func RegisterRouter(service *gin.Engine) {
	userGroup := service.Group("/user")
	userGroup.GET("/login", user.Login)
}

// 注册游戏相关路由
func RegisterGameRouter(service *gin.Engine) {
	gameGroup := service.Group("/example")
	gameGroup.GET("/take", example.Take)
	gameGroup.GET("/take_ws", example.TakeWS)
}

// 注册静态文件
func RegisterStaticRouter(service *gin.Engine) {
	fileGroup := service.Group("./file")
	fileGroup.Static("/js", "./app/file/js")
	fileGroup.Static("/img", "./app/file/img")
}
